<?php ob_start();?>
<?php 
	$root = $_SERVER['DOCUMENT_ROOT'];
	/*TODO: burasi duzeltilecek*/
 	include($root.'/standart/head.php');
 	include($root.'/standart/dateHeader.php');
 	include($root.'/standart/dbconnect.php');
 	include($root.'/cart/ShoppingCart.class.php');
 	include($root.'/cart/MenuItem.class.php');
 	$db = connect();
?>
<?php
session_start();
if(isset($_COOKIE['tzRemember'])){
	$_SESSION['id'] = $_COOKIE["gevezeUser"];
	$_SESSION['usr'] = $_COOKIE["gevezeMail"];
}
if(isset($_GET['logoff']))
{
	$_SESSION = array();
	session_destroy();
	setcookie("tzRemember","", time() -3600);
	setcookie("gevezeMail","", time() -3600);
	setcookie("gevezeUser","", time() -3600);
	header("Location: index.php");
	exit;
}
?>

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Geveze Cafe | Ana Sayfa</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--Google Fonts-->
<link href='http://fonts.googleapis.com/css?family=Oswald|Lato|Roboto:400,500,700|Open+Sans:600,700,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Pacifico' rel='stylesheet' type='text/css'>
<!--Custom Css-->
<link href="css/custom.css" rel="stylesheet" type="text/css">
<link href="css/tinyBox.css" rel="stylesheet" type="text/css" media="screen"/>
<!--Colors Css-->
<link href="css/colors_3.css" rel="stylesheet" type="text/css">
<!--Boostrap Css-->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<!--Boostrap-Responsice Css-->
<link href="css/bootstrap-responsive.css" rel="stylesheet" type="text/css">
<!--Calender Css-->
<link rel='stylesheet' type='text/css' href='css/fullcalendar.css' />
<!--Awesome Fonts-->
<link href="css/font-awesome.css" rel="stylesheet">
<!--Banner Slider-->
<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" />
<!--Scrollbar Css-->
<link href="css/jquery.mCustomScrollbar.css" rel="stylesheet" />
<!--Pie Chart Css-->
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
<!--J Carousel-->
<link rel="stylesheet" type="text/css" href="skins/tango/skin.css" />
<link rel="stylesheet" type="text/css" href="css/slide.css" media="screen" />
<!-- Html5 Js -->
<script src="js/html5.js" type="text/javascript"></script>
</head>

<body onload="onPageLoad()">
<div id="toppanel">
	<div id="panel">
		<div class="content clearfix">
	        <?php
			if(!$_SESSION['id']):
			?>
			<div class="right">
				<!-- Login Form -->
				<form class="clearfix" action="" method="post" id="loginForm">
					
					<table style="border: none; width: 100%;">
						<tr>							
							<td>
								<input class="field" type="text" name="username" id="username" value="" size="23" placeholder="E-Mail"/>
							</td>
							<td>
								<input class="field" type="password" name="password" id="password" size="23" placeholder="Şifre" />
							</td>							
							<td>
								<a style="cursor: pointer;" onclick="forgetPass()">Şifremi Unuttum</a>
							</td>
						</tr>
						<tr>
							<td>
								<label><input name="rememberMe" id="rememberMe" type="checkbox" checked="checked" value="1" /> &nbsp;Beni hatırla</label>
							</td>
							<td>
								<input class="btn btn-success btn-xl" style="line-height: 12px; padding-left:30px; padding-right:30px;" type="button" name="submit" value="Giriş"  onclick="sendData()" />
							</td>
							<td>
								<input class="btn btn-info btn-lg"  value="Kayıt Ol" style="cursor: pointer; right: 0px; float: right; line-height: 12px;" type="button" onclick="window.location.replace('register.php')"/>
							</td>
						</tr>
					</table>
				</form>
			</div>
            <?php
			
			else:
			
			?>
            
            <div class="right">
            	<input class="btn btn-danger btn-xl" type="button" style="cursor: pointer; right: 0px; float: right; line-height: 12px; padding-right:30px; padding-left:30px;" onclick="window.location.replace('?logoff')" value="Çıkış"/>
            	<div class="loginTop"><?php echo $_SESSION['usr'] ? 'Merhaba '.$_SESSION['usr'] : '';?> <br/></div>
	            <div class="loginMenu">
	            	<div class="loginMenuLeft" onclick="window.location.replace('order-list.php')"> Siparişlerim </div>
	            	<div class="loginMenuMid" onclick="window.location.replace('user-info-change.php')"> Kişisel Bilgilerim </div>
	            	<div class="loginMenuMid" onclick="window.location.replace('add-address.php')"> Adres Ekle</div>
	            	<div class="loginMenuRight" onclick="window.location.replace('change-password.php')"> Şifre Değiştir </div>
	            </div>
            </div>
            <?php
			endif;
			?>
		</div>
	</div> <!-- /login -->	

    <!-- The tab on top -->	
	<div class="tab">
		<ul class="login">
	    	<li class="left">&nbsp;</li>
	        <li id="toggle">
				<a id="open" class="open" href="#"><?php echo $_SESSION['id']?'Kullanıcı Bilgileri':'Üye Girişi | Yeni Üye';?></a>
				<a id="close" style="display: none;" class="closex" href="#">Bilgi Alanını Kapat</a>			
			</li>
	    	<li class="right">&nbsp;</li>
		</ul> 
	</div> <!-- / top -->
	
</div> <!--panel -->
<!--Wrapper Start-->
<div id="wrapper"> 
   <!--Header Start-->
<header id="header"> <!--<span class="icon-dish"></span>-->
    <div class="container">
      <div class="row-fluid">
        <div class="span3">
          <div class="logo"><a href="index.php"><img src="images/logo-gevezecafe.png" alt="img"></a></div>
        </div>
        <div class="span8 margin-non">
          <div class="top-container">
            <div class="span5"></div>
            <div class="span7">
             </div>
          </div>
          <div class="navbar navbar-inverse nav-bar">
            <div class="navbar-inner nav-bar-inner">
              <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
              <div class="nav-collapse collapse top-nav">
                <ul class="nav">
                  <li class="dropdown"> <a class="dropdown-toggle" href="index.php">ANA SAYFA</a>
                  </li>
                  <li class="dropdown"> <a class="dropdown-toggle" href="menu.php" >MENÜ</a>
                  </li>
                  <li class="dropdown"> <a class="dropdown-toggle" href="cart.php" >SEPETİM</a>
                  	<?php 
                  		$shoppingCart = new Shopping_Cart('sepet');
                  		$quantity = $shoppingCart->getAllQuantity();
					?>
                  	<div class="cartCount" id="cartCount" <?php if($quantity == 0){ ?> style="display: none;" <?php } ?>><?php echo $quantity;?></div>
                  </li>
				  <li class="dropdown"> <a class="dropdown-toggle" href="about.php" >HAKKIMIZDA</a>
                  </li>
                  <li class="dropdown"> <a class="dropdown-toggle" href="contact.php" >İLETİŞİM</a></li>
                </ul>
              </div>
              <!--/.nav-collapse --> 
            </div>
            <!-- /.navbar-inner --> 
          </div>
          <!--Nav End--> 
        </div>
      </div>
    </div>
  </header>
  <!--Header End--> 

  <!--Banner Start-->
  <section id="banner">
    <div class="caption">
      <div class="banner-caption">
        <div class="container">
          <div class="row-fluid">
            <div class="span3 banner-left">
              <ul class="bxslider-2">
                <li>
                  <div class="caption-left">
                    <div class="deal-tag"> <strong class="title">Teknopark Kafeterya</strong> </div>
                    <div class="left-caption-box"> <strong class="title">Zengin ürün çeşitlerimizle<br>
                      hizmetinizdeyiz.</strong><img src="images/chef-img.png" alt="img" class="chef-img"> </div>
                  </div>
                </li>
              </ul>
            </div>
            <div class="span9 right-panel">
              <div class="caption-right"> <strong class="title"><span class="text">GÜNLÜK TAZE ÜRÜNLERİMİZ İLE HİZMETİNİZDEYİZ</span></strong> <strong class="open">HAFTA İÇİ HER GÜN:   08<span class="small">00</span> - 19<span class="small">00</span></strong> </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <ul class="bxslider">
      <li><img src="images/banner1.jpg" alt="img" /></li>
      <li><img src="images/banner2.jpg" alt="img" /></li>
    </ul>
  </section>
  <!--Banner End--> 
  
  <!--Content Area Start-->
  
  <section id="content" class="container">
    <section class="featured-section">
      <div class="row-fluid">
        <div class="span3">
        	<div class="accordion accordion-area" id="accordion2">
        	<?php
        	$categoryQuery ="SELECT ID, CATEGORY_NAME FROM CATEGORY ORDER BY CATEGORY_ORDER";
        	$categoryList = $db->query($categoryQuery) or die($categoryQuery."<br/><br/>".mysql_error());
        	$i=1;
        	while($category = $categoryList->fetch_assoc()){
			$categoryId = $category['ID'];
			?>
	            <div class="accordion-group">
	              <div class="<?php if($i==1){echo "accordion-heading active";}else {echo "accordion-heading";}?>"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="<?php echo "#collapse".$i;?>"><?php echo $category['CATEGORY_NAME']?></a> </div>
	              <div id="<?php echo "collapse".$i;?>" class="<?php if($i==1){echo "accordion-body collapse in";}else {echo "accordion-body collapse";}?>">
	                <div class="accordion-inner">
	                  <div class="content-2 scroll" id="<?php echo "content_".($i+1);?>">
	                    <ul class="accordion-list">
						<?php 
						$menuQuery="SELECT * FROM MENU WHERE ID IN (SELECT MENU_ID FROM MENU_FORMAT WHERE CATEGORY_ID = ('$categoryId'))";
						$menuList = $db->query($menuQuery) or die($menuQuery."<br/><br/>".mysql_error());						
						while($menu = $menuList->fetch_assoc()){
							$priceQuery="SELECT * FROM PRICE_LIST WHERE MENU_ID = {$menu['ID']} AND APPLICABLE_FROM<now() ORDER BY APPLICABLE_FROM DESC LIMIT 1";
							$priceResult = $db->query($priceQuery) or die($priceQuery."<br/><br/>".mysql_error());
							while($priceRecord = $priceResult->fetch_assoc()){
								$price = $priceRecord['PRICE'];
							}
							$priceResult->close();
							if(is_null($menu['PICTURE'])){
								$menuImg = "images/breakfast-img-1.jpg";
							}
							else{
								$menuImg = $menu['PICTURE'];
							}							
						?>
	                      <li>
	                        <div class="frame"> <img src="<?php echo $menuImg;?>" alt="img">
	                          <div class="caption"><strong class="title"><?php echo $menu['PRODUCT_NAME']?></strong></div>
	                          	<strong class="price"> <?php echo $price?> TL</strong> 
	                          	<div class="frame-box-bottom <?php echo $menu['ID']?>">
									<ul style="width: 100%;">
		                            	<li style="width: 100%;"> <a style="cursor: pointer;" class="view2">Seç</a> </li>
		                            </ul>
		                          </div>
	                        </div>
	                      </li>
						<?php }
						$menuList->close();
						?>
	                    </ul>
	                  </div>
	                </div>
	              </div>
	            </div>
            <?php $i++;}
            $categoryList->close();
            
            ?>
            
          </div>
          <!-- End Accordian List Menu --> 
        </div>
        <div class="span9" style="float: left;">
          <div class="heading">
            <h2>SİZİN İÇİN SEÇTİKLERİMİZ</h2>
          </div>
          <div class="featured-slider">
            <div id="wrap">
              <ul id="mycarousel" class="jcarousel-skin-tango">
				<?php 
				$featuredQuery ="SELECT * FROM MENU WHERE ID IN (SELECT MENU_ID FROM MENU_FEATURE WHERE ISFEATURED='E')";
				$featuredMenuList = $db->query($featuredQuery) or die($featuredQuery."<br/><br/>".mysql_error());
				while($featuredMenu = $featuredMenuList->fetch_assoc()){
					$priceQuery="SELECT * FROM PRICE_LIST WHERE MENU_ID = {$featuredMenu['ID']} AND APPLICABLE_FROM<now() ORDER BY APPLICABLE_FROM DESC LIMIT 1";
					$priceResult = $db->query($priceQuery) or die($priceQuery."<br/><br/>".mysql_error());
					while($priceRecord = $priceResult->fetch_assoc()){
						$price = $priceRecord['PRICE'];
					}
					if(is_null($featuredMenu['PICTURE'])){
								$menuImg = "images/featured-dishes-img1.jpg";
					}
					else{
						$menuImg = $featuredMenu['PICTURE'];
					}
					?>
					<li><img src="<?php echo $menuImg; ?>" style="width: 248px; height: 260px;" alt="" />
					  <div class="caption">
						<div class="fetured-caption"> <strong class="price"><?php echo $price;?> TL</strong> </div>
					  </div>
					  <strong class="hover-panel"><?php echo $featuredMenu['PRODUCT_NAME'];?>
					  	<div class="feature-box-bottom <?php echo $featuredMenu['ID'];?>">
							<ul style="width: 100%;">
	                        	<li style="width: 100%;"> <a style="cursor: pointer;" class="view2">Seç</a> </li>
	                        </ul>
						  </div>
					  </strong> 
					  
					</li>
				<?php
				}
				/*footer featured icin kapatilmadi*/
				//$featuredMenuList->close();
				?>
              </ul>
            </div>
          </div>
        </div>
        <div class="span9" style="margin-left: 30px; margin-top: 20px; float: left;">
          <div class="events-box">
            <div class="events-box-head">
              <div class="bg-opacity-3">
                <h5>Duyurular &amp; Haberler</h5>
              </div>
            </div>
            <div id="content_1" class="content scroll">
			<ul>
			  	<?php
			  	$eventsQuery ="SELECT * FROM EVENTS WHERE EVENT_DATE>NOW() ORDER BY EVENT_DATE ASC";
				$eventsList = $db->query($eventsQuery) or die($eventsQuery."<br/><br/>".mysql_error());
				$countEvent = 0;
				while($event = $eventsList->fetch_assoc()){
					$countEvent++;
				@setlocale(LC_ALL, 'turkish');
				
				$eventDate = $event['EVENT_DATE'];
				if(is_null($event['EVENT_DATE'])){
					$eventDate = new DateTime('now');
				}
				
				$day=date("d", strtotime($eventDate));
				?>
                <li> 
                <div style="height:140px; width:583px; clear:both; background-color: lightgrey;">
                	<?php if(!is_null($event['EVENT_IMAGE'])){ ?>
	                	<img src="<?php echo $event['EVENT_IMAGE']; ?>" style="height:140px; width:583px;" alt="event-image">
                	<?php } ?>
                </div>
                  <div class="caption">
                    <div class="text"> <strong class="date"><?php echo $day; ?><span class="mnt"><?php echo iconv('latin5', 'utf-8', strftime("%b",strtotime($eventDate))); ?></span></strong> <br> <strong class="title"><?php echo $event['EVENT_TITLE']; ?></strong>
                      <p><?php echo $event['EVENT_DEFINITION']; ?></p>
                    </div>
                  </div>
                </li>
				<?php
				}
				?>
			</ul>
            </div>
          </div>
        </div>
      </div>
    </section>
    <!--Blog Section Start-->

    <!--Blog Section End--> 
    
    <!--Reservation Section Start-->
    <section class="reservation-section">
      <div class="row-fluid"> <img src="images/happy-hour-banner.png" alt="img"> </div>
    </section>
    
    <!--Reservation Section End-->
    
    <section class="event-section">
      <div class="row-fluid">
        <div class="span5">
          <div class="row-fluid">
            <div class="span6">
            <?php
            @setlocale(LC_ALL, 'turkish');
            $eventsList->data_seek(0);
            $eventDate = date("Y-m-d H:i:s");
            $day = date("d");
            if($event = $eventsList->fetch_assoc()){
				$eventDate = $event['EVENT_DATE'];
				$day=date("d", strtotime($eventDate));	
			}
			
			?>
            <div class="calendar-left"> <strong class="day"><?php echo iconv('latin5', 'utf-8', strftime("%A",strtotime($eventDate))); ?></strong> <strong class="date"><?php echo $day; ?></strong> <strong class="time"> <?php echo ($event['START_TIME']==null?"08:00":$event['START_TIME'])." - ".($event['END_TIME']==null?"19:00":$event['END_TIME']) ?></strong> <strong class="title"><?php echo ($event['EVENT_TITLE']==null?"Geveze Cafe":$event['EVENT_TITLE']); ?></strong></div>
            </div>
            <div class="span6 margin-non">
              <div id='calendar'></div>
            </div>
          </div>
        </div>
        <div class="span7">
          <div class="location-map">
            <div class="location-map-head">
              <div class="left-side">
                <h5>Bizi ziyaret edin!</h5>
                <p>IYTE TEKNOPARK<br>
                  URLA İZMİR</p>
              </div>
              <div class="right-side"> <a href="#" class="mark">&nbsp;</a> <a href="#" class="location">&nbsp;</a> </div>
            </div>
            <div class="map-box">
              <div id="map_canvas" style="width:100%; height:205px; vertical-align:central;"><br/>
              </div>
              <!--<img src="images/map-img.jpg" alt="img">--></div>
            <div class="bottom-sec"> <strong class="time">08:00 - 19:00</strong> <a href="#" class="week">Hafta içi her gün</a> </div>
          </div>
        </div>
      </div>
    </section>
  </section>
  <!--Content Area End--> 
    
  <!--Footer Area Start-->
  <footer id="footer">
    <div class="row-fluid">
      <section class="footer-section-1">
        <div class="bg-opacity-2">
          <div class="container">
            <div class="span3">
              <div class="featured-dishes">
                <h4>Sizin İçin Seçtiklerimiz</h4>
				<ul>
				<?php
				$rows = 0;
				$featuredMenuList->data_seek(0);
				while($featuredMenu = $featuredMenuList->fetch_assoc()){
					if(is_null($featuredMenu['PICTURE'])){
						$menuImg = "images/featured-footer-img-1.jpg";
					}
					else{
						$menuImg = $featuredMenu['PICTURE'];
					}
				?>
					<li>
						<div class="frame"><img src="<?php echo $menuImg; ?>" style="width: 113px; height: 50px;" alt="img"></div>
						<div class="footer-box-bottom <?php echo $featuredMenu['ID'];?> text" style="cursor: pointer;"> <strong class="title"><?php echo $featuredMenu['PRODUCT_NAME'];?></strong> </div>
					</li>
				<?php
					$rows++;
					if($rows==3){
						break;
					}
				}
				?>
				</ul>
              </div>
            </div>
            <div class="span1">
            </div>
			<div class="span2">
              <div class="recent-post">
                <div class="featured-dishes">
                  <h4>Site Haritası</h4>
                  <ul>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="index.php">Ana Sayfa</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="menu.php">Menü</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="cart.php">Sepetim</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="about.php">Hakkımızda</a></strong></div>
                    </li>
                    <li class="site-map">
                      <div id="address" class="recent-post-text"> <strong class="title"><a href="contact.html">İletişim</a></strong></div>
                    </li>
                  </ul>
                </div>
              </div>
            </div> 			
            <div class="span3">
              <div class="recent-post">
                <div class="featured-dishes">
                  <h4>Adres</h4>
                  <ul>
                    <li>
                      <div id="address" class="recent-post-text"> <strong class="title">IYTE Teknopark, Gülbahçe<br/>Urla İzmir</strong> </div>
                    </li>
                    <li>
                      <div id="phone" class="recent-post-text"> <strong class="title">Telefon: 0232 765 90 95<br/></strong> </div>
                    </li>
                    <li>
                      <div id="email" class="recent-post-text"> <strong class="title">Email: info@gevezecafe.com</strong> </div>
                    </li>
                  </ul>
                </div>
              </div>
            </div>           
            <div class="span3">
              <div class="watch-box">
                <div class="watch-img"> <img src="images/watch-img.png" alt="img">
                  <div class="time-box"> <strong class="time">Hafta İçi Her Gün</strong> <strong class="time">08:00 - 19:00</strong> </div>
                </div>
                <strong class="book-table">Siparişleriniz İçin: <span class="red">0232 765 9095</span></strong> 
              </div>
            </div>
          </div>
        </div>
      </section>
      <!--Footer Section Section 3 Start-->
      <section class="footer-section-3">
        <div class="container">
          <div class="span6">
            <div class="copy-section"><strong class="copy">&copy; 2014 Teknopark Geveze Cafe, Designed by <a href="http://gevezecafe.com/" class="link" target="_blank">gevezecafe.com</a></strong></div>
          </div>
          <div class="span6">
            <div class="footer-social-box">
              <ul>
                <li class="social-icon-1"><a href="#">p</a></li>
                <li class="social-icon-2"><a href="#">twitter</a></li>
                <li class="social-icon-3"><a href="#">facebook</a></li>
                <li class="social-icon-4"><a href="#">facebook</a></li>
                <li class="social-icon-5"><a href="#">facebook</a></li>
                <li class="social-icon-6"><a href="#">facebook</a></li>
              </ul>
            </div>
          </div>
        </div>
      </section>
      <!--Footer Section Section 3 End--> 
    </div>
  </footer>
  <!--Footer Area End--> 
  <p id="back-top"> <a href="#top" class="back-top">Back to Top</a> </p>
</div>
<div id="invisDiv" style="display: none;"></div>
<div class="cartCount" style="width: 0px; height: 0px; position: absolute; opacity: 0.7; z-index:850; filter: alpha(opacity=70);" id="addCart">+1</div>
<!--Wrapper End--> 
<?php disconnect($db); ?>
<!-- jQuery --> 
<script type="text/javascript" src="js/jquery-1.8.1.min.js"></script><!-- lib Js --> 

<!-- Bootstrap --> 
<script src="js/bootstrap.js" type="text/javascript"></script><!-- Boostrap Js --> 

<!-- FlexSlider --> 
<script defer src="js/jquery.flexslider.js"></script> <!-- FlexSlider --> 

<!-- Calender --> 
<script type='text/javascript' src='js/fullcalendar.js'></script><!-- Calender Js--> 

<!--Google Map--> 
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true"></script><!--Google Map-->

<!--Scrool js--> 
<script src="js/jquery.mCustomScrollbar.concat.min.js"></script><!--Scrool js--> 

<!--Pie Chart--> 
<script type="text/javascript" src="js/excanvas.js"></script> <!--Pie Chart--> 
<script type="text/javascript" src="js/jquery.easy-pie-chart.js"></script><!--Pie Chart--> 

<!--Bx Slider--> 
<script src="js/jquery.bxslider.js"></script> <!--Bx Slider--> 

<!-- Custom Scripts --> 
<script src="js/custom.js" type="text/javascript"></script><!-- Custom Scripts --> 

<!--J Carousel--> 
<script type="text/javascript" src="js/jquery.jcarousel.min.js"></script><!--J Carousel-->
<script type="text/javascript" src="js/tinybox.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript" src="js/login.js"></script>
<script type="text/javascript" src="cart/cart.js"></script> 
<script type="text/javascript">

<?php if($countEvent <= 1){?>
document.getElementById('content_1').style.height = '141px';
<?php }?>

function onPageLoad(){

var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();

$('#calendar').fullCalendar({
	editable: true,
	//weekends: false, // will hide Saturdays and Sundays
	events: [
			<?php
					$eventsList->data_seek(0);
					$eventCount = 0;
					while($event = $eventsList->fetch_assoc()){
						$d = date("d",strtotime($event["EVENT_DATE"]));
						$m = date("m",strtotime($event["EVENT_DATE"]));
						$y = date("Y",strtotime($event["EVENT_DATE"]));
						if($eventCount!=0){
							echo ",";
						}
						?>
						{
							title: <?php echo "\"".$event['EVENT_TITLE']."\""; ?>,
							start: new Date(<?php echo $y.", ".($m-1).", ".$d;?>)
						}
						<?php
						$eventCount++;
					}
					?>
			]
		});
	}

function openNewUnit(htm, type) {
	TINY.box.show({html:htm,close:false,boxid:type,top:20,width:500,height:100});
	setTimeout(function(){closeBox()}, 5000);
}

function closeBox() {
	TINY.box.hide();
}
	
</script>
</body>
</html>
